// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.
use crate::Result;

/// Implements a [Config](super::stub::Config) decorator for logging and tracing.
#[derive(Clone, Debug)]
pub struct Config<T>
where
    T: super::stub::Config + std::fmt::Debug + Send + Sync,
{
    inner: T,
}

impl<T> Config<T>
where
    T: super::stub::Config + std::fmt::Debug + Send + Sync,
{
    pub fn new(inner: T) -> Self {
        Self { inner }
    }
}

impl<T> super::stub::Config for Config<T>
where
    T: super::stub::Config + std::fmt::Debug + Send + Sync,
{
    #[tracing::instrument(ret)]
    async fn list_deployments(
        &self,
        req: crate::model::ListDeploymentsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListDeploymentsResponse>> {
        self.inner.list_deployments(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_deployment(
        &self,
        req: crate::model::GetDeploymentRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::Deployment>> {
        self.inner.get_deployment(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn create_deployment(
        &self,
        req: crate::model::CreateDeploymentRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.create_deployment(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn update_deployment(
        &self,
        req: crate::model::UpdateDeploymentRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.update_deployment(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn delete_deployment(
        &self,
        req: crate::model::DeleteDeploymentRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.delete_deployment(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_revisions(
        &self,
        req: crate::model::ListRevisionsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListRevisionsResponse>> {
        self.inner.list_revisions(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_revision(
        &self,
        req: crate::model::GetRevisionRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::Revision>> {
        self.inner.get_revision(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_resource(
        &self,
        req: crate::model::GetResourceRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::Resource>> {
        self.inner.get_resource(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_resources(
        &self,
        req: crate::model::ListResourcesRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListResourcesResponse>> {
        self.inner.list_resources(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn export_deployment_statefile(
        &self,
        req: crate::model::ExportDeploymentStatefileRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::Statefile>> {
        self.inner.export_deployment_statefile(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn export_revision_statefile(
        &self,
        req: crate::model::ExportRevisionStatefileRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::Statefile>> {
        self.inner.export_revision_statefile(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn import_statefile(
        &self,
        req: crate::model::ImportStatefileRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::Statefile>> {
        self.inner.import_statefile(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn delete_statefile(
        &self,
        req: crate::model::DeleteStatefileRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<()>> {
        self.inner.delete_statefile(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn lock_deployment(
        &self,
        req: crate::model::LockDeploymentRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.lock_deployment(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn unlock_deployment(
        &self,
        req: crate::model::UnlockDeploymentRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.unlock_deployment(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn export_lock_info(
        &self,
        req: crate::model::ExportLockInfoRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::LockInfo>> {
        self.inner.export_lock_info(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn create_preview(
        &self,
        req: crate::model::CreatePreviewRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.create_preview(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_preview(
        &self,
        req: crate::model::GetPreviewRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::Preview>> {
        self.inner.get_preview(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_previews(
        &self,
        req: crate::model::ListPreviewsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListPreviewsResponse>> {
        self.inner.list_previews(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn delete_preview(
        &self,
        req: crate::model::DeletePreviewRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.delete_preview(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn export_preview_result(
        &self,
        req: crate::model::ExportPreviewResultRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ExportPreviewResultResponse>> {
        self.inner.export_preview_result(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_terraform_versions(
        &self,
        req: crate::model::ListTerraformVersionsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListTerraformVersionsResponse>> {
        self.inner.list_terraform_versions(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_terraform_version(
        &self,
        req: crate::model::GetTerraformVersionRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::TerraformVersion>> {
        self.inner.get_terraform_version(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_resource_changes(
        &self,
        req: crate::model::ListResourceChangesRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListResourceChangesResponse>> {
        self.inner.list_resource_changes(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_resource_change(
        &self,
        req: crate::model::GetResourceChangeRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ResourceChange>> {
        self.inner.get_resource_change(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_resource_drifts(
        &self,
        req: crate::model::ListResourceDriftsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListResourceDriftsResponse>> {
        self.inner.list_resource_drifts(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_resource_drift(
        &self,
        req: crate::model::GetResourceDriftRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ResourceDrift>> {
        self.inner.get_resource_drift(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_locations(
        &self,
        req: location::model::ListLocationsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<location::model::ListLocationsResponse>> {
        self.inner.list_locations(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_location(
        &self,
        req: location::model::GetLocationRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<location::model::Location>> {
        self.inner.get_location(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn set_iam_policy(
        &self,
        req: iam_v1::model::SetIamPolicyRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<iam_v1::model::Policy>> {
        self.inner.set_iam_policy(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_iam_policy(
        &self,
        req: iam_v1::model::GetIamPolicyRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<iam_v1::model::Policy>> {
        self.inner.get_iam_policy(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn test_iam_permissions(
        &self,
        req: iam_v1::model::TestIamPermissionsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<iam_v1::model::TestIamPermissionsResponse>> {
        self.inner.test_iam_permissions(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_operations(
        &self,
        req: longrunning::model::ListOperationsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::ListOperationsResponse>> {
        self.inner.list_operations(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_operation(
        &self,
        req: longrunning::model::GetOperationRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.get_operation(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn delete_operation(
        &self,
        req: longrunning::model::DeleteOperationRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<()>> {
        self.inner.delete_operation(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn cancel_operation(
        &self,
        req: longrunning::model::CancelOperationRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<()>> {
        self.inner.cancel_operation(req, options).await
    }

    fn get_polling_error_policy(
        &self,
        options: &gax::options::RequestOptions,
    ) -> std::sync::Arc<dyn gax::polling_error_policy::PollingErrorPolicy> {
        self.inner.get_polling_error_policy(options)
    }

    fn get_polling_backoff_policy(
        &self,
        options: &gax::options::RequestOptions,
    ) -> std::sync::Arc<dyn gax::polling_backoff_policy::PollingBackoffPolicy> {
        self.inner.get_polling_backoff_policy(options)
    }
}
